package com.itheima.mybatis.mapper;

import com.itheima.mybatis.pojo.table;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper //在程序运行时会自动生成 该接口的实现类（代理对象）并且将该对象交给IOC容器管理
public interface UserMapper {
    //查询全部信息
    @Select("select * from first_table")
    public List<table> selectAllTable();


    //单条查询
    @Select("select * from first_table where Id=#{id}")
    public table selectById(int id);

    //删除
    @Delete("delete from first_table where Id=#{id}")
    public void delete(int id);

    //插入
    @Options(keyProperty = "id",useGeneratedKeys = true)
    @Insert("insert into first_table(item_name, value) " +
            "value(#{item_name},#{value}) ")
    public void insert(table t);

    //更新
    @Update("update first_table set item_name= #{item_name} , Value=#{value} where Id=#{id}")
    public void update(table t);

}
